<template>
	<view>
		<view class="flex-row bar-bottom" v-if="data.__user_info.blacklist!==1">
    <view class="flex-grow-0 flex-row">
        <navigator class="flex-grow-0 flex-y-center bar-bottom-btn" openType="redirect" :url="'/store/shop/shop?store_id='+data.goods.store.id" v-if="data.pageType==='DAPP'&&data.goods.store">
            <view>
                <image :src="data.__wxapp_img.dapp.dapp.url"></image>
                <text>店铺</text>
            </view>
        </navigator>
        <view @tap="$emit('goHome',$event)" class="flex-grow-0 flex-y-center bar-bottom-btn">
            <view>
                <image :src="data.__wxapp_img.dapp.dapp.url"></image>
                <text>首页</text>
            </view>
        </view>
        <block v-if="data.pageType===data.BOOK">
            <button class="flex-grow-0 flex-col flex-y-center flex-x-center goods-footer-icon" openType="contact" v-if="data.__platform=='wx'">
                <view class="flex-gorw-0 flex-x-center">
                    <image :src="data.__wxapp_img.user.kf.url"></image>
                </view>
                <view class="flex-gorw-0 flex-x-center">
                        客服
                    </view>
            </button>
            <view class="flex-grow-0 flex-col flex-y-center flex-x-center goods-footer-icon" style="position: relative" v-if="data.__platform=='my'">
                <view class="flex-x-center flex-y-center" style="z-index:2;width: 100%;height: 100%;position: absolute;left: 0;top:0;opacity: 0">
                    <contact-button :scene="data.__alipay_mp_config.cs_scene" size="50" :tntInstId="data.__alipay_mp_config.cs_tnt_inst_id"></contact-button>
                </view>
                <image :src="data.__wxapp_img.user.kf.url"></image>
                <view class="flex-gorw-0 flex-x-center">
                        客服
                    </view>
            </view>
        </block>
        <block v-if="data.pageType==='DAPP'">
            <view @tap="$emit('favoriteRemove',$event)" class="flex-grow-0 flex-y-center bar-bottom-btn" v-if="data.goods.is_favorite&&data.goods.is_favorite==1">
                <view>
                    <image :src="data.__wxapp_img.dapp.favorite_active.url"></image>
                    <text>已收藏</text>
                </view>
            </view>
            <view @tap="$emit('favoriteAdd',$event)" class="flex-grow-0 flex-y-center bar-bottom-btn" v-else>
                <view>
                    <image :src="data.__wxapp_img.dapp.favorite.url"></image>
                    <text>收藏</text>
                </view>
            </view>
        </block>
    </view>
    <block v-if="data.pageType==='DAPP'">
        <view class="flex-grow-1 flex-row" v-if="data.goods.is_negotiable">
            <view class="flex-grow-1 flex-y-center flex-x-center add-cart" style="background:#118eea" v-if="data.dapp.good_negotiable.contact==1">
                <block v-if="data.__platform=='wx'">
                    <view @tap="$emit('kfMessage',$event)" class="flex-x-center flex-y-center _negotiable" v-if="!data.dapp.show_customer_service">客服</view>
                    <button class="flex-x-center flex-y-center _negotiable" openType="contact" :sessionFrom="data.__user_info.nickname" v-else>客服</button>
                </block>
                <view class="float-icon-btn" style="position: relative" v-if="data.__platform=='my'">
                    <view class="flex-x-center flex-y-center" style="z-index:2;width: 100%;border-radius:50%;height: 100%;position: absolute;left: 0;top:0;opacity: 0">
                        <contact-button :scene="data.__alipay_mp_config.cs_scene" size="60" :tntInstId="data.__alipay_mp_config.cs_tnt_inst_id"></contact-button>
                    </view>
                        客服
                    </view>
            </view>
            <view class="flex-grow-1  contact" v-if="data.dapp.good_negotiable.web_contact==1">
                <navigator class="flex-y-center flex-x-center" hoverClass="none" openType="navigate" style="height:100%;width:100%" :url="'/pages/web/web?url='+data.dapp.option.web_service_url">客服</navigator>
            </view>
            <view @tap="$emit('callPhone',$event)" class="flex-grow-1 flex-y-center flex-x-center buy-now" :data-info="data.dapp.contact_tel" v-if="data.dapp.good_negotiable.tel==1">联系电话</view>
        </view>
        <view class="flex-grow-1 flex-row" v-else>
            <view @tap="$emit('addCart',$event)" class="flex-grow-1 flex-y-center flex-x-center add-cart">加入购物车</view>
            <view @tap="$emit('buyNow',$event)" class="flex-grow-1 flex-y-center flex-x-center buy-now">立即购买</view>
        </view>
    </block>
    <view class="flex-grow-1 flex-row" v-if="data.pageType==='MIAOSHA'">
        <view @tap="$emit('buyNow',$event)" class="flex-grow-1 flex-y-center flex-x-center buy-now">立即购买</view>
    </view>
    <view @tap="$emit('bespeakNow',$event)" class="flex-grow-1 flex-y-center flex-x-center group-buy" :style="data.goods.is_only==1?('width: '+upx_338):''" v-if="data.pageType==='BOOK'">
            立即预约
        </view>
    <view class="flex-grow-1 flex-row" v-if="data.pageType==='INTEGRAL'">
        <view catchtap="exchangeGoods" class="flex-grow-1 flex-y-center flex-x-center buy-now">立即兑换</view>
    </view>
    <block v-if="data.pageType==='PINTUAN'">
        <view @tap="$emit('onlyBuy',$event)" class="flex-grow-1 flex-col flex-y-center flex-x-center alone-buy" v-if="data.goods.is_only==1">
            <view class="flex-gorw-0 money">
                ¥{{data.goods.single_price}}
            </view>
            <view class="flex-grow-0">
                单独购买
            </view>
        </view>
        <view @tap="$emit('buyNow',$event)" class="flex-grow-1 flex-col flex-y-center flex-x-center group-buy" :style="data.goods.is_only==1?('width: '+upx_338):''">
            <view class="flex-gorw-0 money">
                ¥{{data.goods.group_price}}
            </view>
            <view class="flex-grow-0">
                {{data.oid?'参团':'拼团'}}
            </view>
        </view>
    </block>
    <view class="flex-grow-1 flex-row" v-if="data.pageType==='STEP'">
        <view catchtap="exchangeGoods" class="flex-grow-1 flex-y-center flex-x-center buy-now" style="background-color:#ff9d1e;width:644upx">立即兑换</view>
    </view>
</view>

	</view>
</template>

<script>var myVue = {};
	export default {
		computed: {
			upx_338() {
				return uni.upx2px(338)+'px';
			}
		},
		props:{
			data: {
				type: Object,
				default: function(){
					return {
						goods: {}
					}
				}
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style scoped>
.bar-bottom {
    position: fixed;
    bottom: var(--window-bottom);
    left: 0;
    z-index: 999;
    width: 100%;
    box-shadow: 0 0 3upx rgba(0,0,0,0.2);
    height: 110upx;
}

.bar-bottom-btn {
    border: none;
    background: #fff;
    font-size: 0;
    line-height: normal;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    position: inherit;
    border-left: 1upx solid #e3e3e3;
    width: 110upx;
}

.bar-bottom-btn:after {
    display: none;
}

.bar-bottom-btn:first-child {
    border-left: none;
}

.bar-bottom-btn.button-hover {
    background: rgba(255,255,255,0.85);
}

.bar-bottom-btn view {
    text-align: center;
    width: 100%;
}

.bar-bottom-btn image {
    width: 38upx;
    height: 38upx;
    margin-bottom: 0upx;
}

.bar-bottom-btn text {
    font-size: 8pt;
    color: #888;
    display: block;
}

.bar-bottom .add-cart {
    background: #FDE6E6;
    color: #FF6C64;
}

.bar-bottom .buy-now {
    background: #FF6C64;
    color: #fff;
}

._negotiable {
    height: 100%;
    width: 100%;
    background: none!important;
    border: none!important;
    border-radius: 0!important;
    padding: 0!important;
    margin: 0!important;
    line-height: inherit!important;
    font-family: inherit!important;
    color: inherit!important;
}

._negotiable:before,._negotiable:after {
    border-radius: 0!important;
    border: none!important;
}
.group-buy {
    color: #ffffff;
    font-size: 13pt;
    background-color: #FF4545;
    width: 564upx;
}
</style>
